home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutor.exe
/
SOURCE
/
READGOOD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-15
|
622b
|
42 lines
/* Chapter 10 - Program 5 - READGOOD.C */
#include "stdio.h"
void main()
{
FILE *fp1;
char oneword[100];
char c;
fp1 = fopen("TENLINES.TXT", "r");
do {
c = fscanf(fp1, "%s", oneword); /* get one word from file */
if (c != EOF)
printf("%s\n", oneword); /* display it on the monitor */
} while (c != EOF); /* repeat until EOF */
fclose(fp1);
}
/* Result of execution
This
is
an
example
line.
Line
number
1
This
is
... (Many other lines.) ...
Additional
lines.
Additional
lines.
*/